using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_ScheduleMap : EntityTypeConfiguration<SO_Schedule>
    {
        public SO_ScheduleMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Appointement__, t.Status, t.Recall_Condition, t.Unconfirmation_Reason });

            // Properties
            this.Property(t => t.Appointement__)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Patient__)
                .HasMaxLength(15);

            this.Property(t => t.Patient_name)
                .IsFixedLength()
                .HasMaxLength(72);

            this.Property(t => t.Full_name)
                .IsFixedLength()
                .HasMaxLength(72);

            this.Property(t => t.Arabic_Full_Name)
                .IsFixedLength()
                .HasMaxLength(72);

            this.Property(t => t.Case__)
                .IsFixedLength()
                .HasMaxLength(12);

            this.Property(t => t.Age)
                .HasMaxLength(15);

            this.Property(t => t.Appointment_time)
                .IsFixedLength()
                .HasMaxLength(8);

            this.Property(t => t.Duration)
                .HasMaxLength(12);

            this.Property(t => t.home_phone)
                .IsFixedLength()
                .HasMaxLength(30);

            this.Property(t => t.mobile_phone)
                .IsFixedLength()
                .HasMaxLength(20);

            this.Property(t => t.Room)
                .IsFixedLength()
                .HasMaxLength(20);

            this.Property(t => t.Operation)
                .IsFixedLength()
                .HasMaxLength(6);

            this.Property(t => t.Status)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(t => t.Recall_Condition)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(t => t.Unconfirmation_Reason)
                .IsRequired()
                .HasMaxLength(17);

            this.Property(t => t.Physician)
                .HasMaxLength(50);

            this.Property(t => t.User_Name)
                .HasMaxLength(15);

            this.Property(t => t.Comment)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("SO_Schedule");
            this.Property(t => t.Appointement__).HasColumnName("Appointement_#");
            this.Property(t => t.Patient__).HasColumnName("Patient_#");
            this.Property(t => t.Patient_name).HasColumnName("Patient_name");
            this.Property(t => t.Full_name).HasColumnName("Full_name");
            this.Property(t => t.Arabic_Full_Name).HasColumnName("Arabic_Full_Name");
            this.Property(t => t.Case__).HasColumnName("Case_#");
            this.Property(t => t.Age).HasColumnName("Age");
            this.Property(t => t.Appointment_date).HasColumnName("Appointment_date");
            this.Property(t => t.Appointment_time).HasColumnName("Appointment_time");
            this.Property(t => t.Duration).HasColumnName("Duration");
            this.Property(t => t.home_phone).HasColumnName("home_phone");
            this.Property(t => t.mobile_phone).HasColumnName("mobile_phone");
            this.Property(t => t.Booking_Date).HasColumnName("Booking_Date");
            this.Property(t => t.Room).HasColumnName("Room");
            this.Property(t => t.Operation).HasColumnName("Operation");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Recall_Condition).HasColumnName("Recall_Condition");
            this.Property(t => t.Unconfirmation_Reason).HasColumnName("Unconfirmation_Reason");
            this.Property(t => t.Physician).HasColumnName("Physician");
            this.Property(t => t.User_Name).HasColumnName("User_Name");
            this.Property(t => t.Comment).HasColumnName("Comment");
        }
    }
}
